import Vue from 'vue'
import Router from 'vue-router'

import About from '../components/about/About'

import Admin from '../components/Admin'
import Home from '../components/Home'
import Menu from '../components/Menu'
import Login from '../components/Login'
import Register from '../components/Register'
import Tabs from '../components/Tabs'
import Touchs from '../components/Touch'
import Contact from '../components/about/Contact'
import Delivery from '../components/about/Delivery'
import History from '../components/about/History'
import OrderingGuide from '../components/about/OrderingGuide'
import Phone from '../components/about/contact/Phone'
import PhoneName from '../components/about/contact/PhoneName'

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      redirect: '/home',
      meta: { title: '系统首页' }
  },
    {path:"/home",components:{
      default:Home,
       'orderingGuide':OrderingGuide,
       'history':History,
       'delivery':Delivery
     },name:"homeLink",   meta: { title: '系统首页' }},
  //  {path:"/admin",component:Admin,name:"adminLink",   meta: { title: '管理页面' }
  //    // ,
  //    //beforeEnter:(to,from,next)=>{
  //    //路由独享守卫
  //    /* alert("还没有登录，请先登录");
  //     next('/login');*/
  //    // }
  //  },       
  {path:"/admin",component:Admin,name:"adminLink", meta: { title: '管理页面' }}
   ,
   {path:"/Tabs",component:Tabs,name:"Tabs", meta: { title: 'Tabs页面' }},
   {path:"/touchs",component:Touchs,name:"touchs", meta: { title: 'touchs页面' }},
   {path:"/menu",name:"menuLink",component:Menu, meta: { title: '菜单' }},
   {path:"/about",component:About,name:"aboutLink",redirect:"/about/contact",children:[
       {path:"/about/contact",redirect:"/phone",component:Contact,name:"contactLink",children:[
           {path:"/phone",component:Phone,name:"phoneLink",  meta: { title: '电话号码' }},
           {path:"/phoneName",component:PhoneName,name:"phoneNameLink",  meta: { title: '姓名' }}
         ]},
       {path:"/delivery",component:Delivery,name:"deliveryLink"},
       {path:"/history",component:History,name:"historyLink"},
       {path:"/orderingGuide",component:OrderingGuide,name:"orderingGuideLink", meta: { title: '点餐文档' }},
     ]},
   {path:"/register",component:Register},
   {path:"/login",component:Login},
   {path:"*",redirect:"/"}

  ]
})
